package com.kstech.mp3604.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import com.chad.library.adapter4.BaseQuickAdapter
import com.kstech.mp3604.bean.Log
import com.kstech.mp3604.databinding.HistoryerrorItemLayoutBinding

/**
 * author: blankii
 * created on: 2025年7月14日14:05:20
 * description:
 */
class LogAdapter : BaseQuickAdapter<Log, LogAdapter.VH>() {
    // 自定义ViewHolder类
    class VH(
        parent: ViewGroup,
        val binding: HistoryerrorItemLayoutBinding = HistoryerrorItemLayoutBinding.inflate(
            LayoutInflater.from(parent.context), parent, false
        ),
    ) : RecyclerView.ViewHolder(binding.root)

    override fun onBindViewHolder(holder: VH, position: Int, item: Log?) {
        holder.binding.time.text = item!!.time
//        holder.binding.errorIndex.text = item.errorIndex
        holder.binding.errorCode.text = item.content
    }

    override fun onCreateViewHolder(context: Context, parent: ViewGroup, viewType: Int): VH {
        return VH(parent)
    }

}